Recently in pondering Log4cplus, this is indeed an artifact.
It's easy to use, but the script takes some time to understand.
OK, no more nonsense, the following is my configuration of the script, I hope to give friends some help:
[Plain] View Plain copy log4cplus.rootlogger=trace,stdout,all_msgs,err_msgs,debug_ msgs,specifial_msgs log4cplus.appender.stdout=log4cplus:: consoleappender log4cplus.appender.s
, VLog.h #pragma once #ifndef vlog_h #define VLOG_H #include
VLog.cpp
/************************************************************************//* Usage rules: */* Need log4cplus Dynamic/static link library and header file////////////* Log4cplus.lib + LOG4CPLUS.D ll is a dynamic link library. Log4cplusS.lib for static link library * */************************************************************************/#include " VLog.h "void Initlog4cplus" (c
Implement log4cplus to write logs in a single process, single thread, or single process, and separate logs by size
Filter log information based on script configurationIn addition to program configuration of the log environment, log4cplus implements script-based configuration through the PropertyConfigurator class. PassThe script can complete the configuration of logger, appender, and layout, so it can solve
Part of the reference to the blog.
Http://www.cppblog.com/tx7do/articles/11719.html
Filter log information based on script configurationIn addition to the configuration of the log environment through the program, Log4cplus implements the scripting-based functionality through the Propertyconfigurator class. PassThe script can complete the configuration of logger, appender and layout, so it can solve the problem of how to output and where to go, I will
Filter log information based on script configurationIn addition to the configuration of the log environment through the program . Log4cplus implements script-based configuration functionality through the Propertyconfigurator class. PassThe script can complete the configuration of logger, Appender, and layout. So it can solve the problem of how to output and where to output. I will be at the end of the fullPart of this section mentions how scripting co
Filter log information based on script configurationIn addition to implementing the configuration of the log environment through the program , Log4cplus implements script-based configuration functionality through the Propertyconfigurator class. PassThe script can complete the configuration of logger, appender and layout, so it can solve the problem of how to output and where to output, I will be at the end of the full textPart of the article mentions
:Log4cplus: http://sourceforge.net/projects/log4cplus/
Great Chinese documentation:
(Can directly go to the family of classification list: http://www.cppblog.com/tx7do/category/1516.html)
Open-source log system log4cplus (1) Open-source log system log4cplus (2)Open-source log system
"Propertyconfigurator" to read the configuration from a file, the parameter is the file name. Other parameters are default.
The contents of the configuration file are as follows:
1. Select Logger
Logger Logger = Logger::getroot (); This is used to choose Rootlogger.
The others can also be configured with more Logger,logger Logger = log4cplus::logger::getinstance ("test");
In general, it is not necessary.
2. Log Output Level TRACE
The first parameter
Use log4cplus (3)-log redirection and log4cplus redirection
This article describes how to output log4cplus logs to qt widgets and encapsulate serverSocket.Log4cplus supports custom output devices. You only need to inherit from Appender or Appender subclass and implement the append member method. After log4cplus is init
Log4cplus is excellent in many aspects, but it is uncomfortable to use it in some places. I'm not happy with it until I continue to talk about it.I will mention it a little and continue to introduce the knowledge about threads and sockets.
### Some improvements ###
1. The implementation mechanism of user-defined loglevel is not open enough
In article 5, I have introduced how to implement custom loglevel. To achieve better results, I even need to chang
Log4cplus is excellent in many aspects, but it is uncomfortable to use it in some places. I'm not happy with it until I continue to talk about it.I will mention it a little and continue to introduce the knowledge about threads and sockets.### Some improvements ###1. The implementation mechanism of user-defined loglevel is not open enoughIn article 5, I have introduced how to implement custom loglevel. To achieve better results, I even need to change l
Download Log4cplus
The latest log4cplus can be downloaded from the following Web site http://sourceforge.net/projects/log4cplus/files/log4cplus-stable/
The version used in this article is: 1.1.3
Compiling the build DLL
After downloading, unpack, open Log4cplus.sln file, select
media
2. Instantiate a layout object that encapsulates the output format
3. Bind the Layout object (attach) to Appender
4. Access to Logger objects
5. Bind Append to Logger
6. Set the log level of the logger
7. Print Log
Example program:
#include
This is a simple example, more specific use of the way you can go to more detailed information: such as: http://wenku.baidu.com/view/51d96c1d964bcf84b9d57b9c.
Log4cplus is a C + + written open source of the log system, the function is very comprehensive, the use of their own development of the project will be more professional. This article describes the configuration of Log4cplus in VS2005.
First download the Log4cplus source code (I am using version 1.03). There are log4cplus_dll in the solution, and
Log4cplus is a C + + written open source log system, the function is very comprehensive, using their own development of the project will be more professional,:, this article describes the basic concept of log4cplus, and how to install, configure.
### Profile ###
Log4cplus is a C + + written open source of the log system, the predecessor of the Java-written
Logging is an effective tool for all software debugging and positioning issues, and having a good journaling system can help developers quickly locate where the problem may be. A good log system can be arbitrarily controlled according to the user's wishes which log can be output, when it can be output. The same is also possible through the configuration file to control the log output level arbitrarily.
Log4cplus is an excellent open source log library
Log4cplus has three main components:
Layouts
Appenders
Loggers
These three type of components found the basic of the log4cplus framework.
Here is a simplified UML Graph Modeling strating the relationships of those classes:
(1) A "layout" Class determines the format of the log message (How do we print out the message ).And log4cplus co
Log4cplus is a C + + written open-source log system, the function is very comprehensive, used in their own development of the project will be more professional,:), this article introduced the basic concept of log4cplus, and how to install, configuration.
Introduction # # # #Log4cplus is an open-source log system written by C + +, formerly known as the LOG4J syste
How to control the Output Message format
As mentioned earlier, log4cplus uses layouts to control the output format. log4cplus provides three types of layouts,
They are simplelayout, patternlayout, and ttcclayout.
1. simplelayoutIt is a simple format la er that adds a loglevel and a "-" before the original output information "-".
For example, the following code sn
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.